package demo.practice.leetcode_base;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class P125 {

    public static void main(String[] args) {
        P125 p125= new P125();
        p125.isPalindrome("0P");
    }

    public boolean isPalindrome(String s) {
        List<Character> allchars= new ArrayList<>();
        int cha= 'a'-'A';
        for(int i=0;i<s.length();i++){

            char c= s.charAt(i);
            if( (c>='0' && c<='9')|| (c>='a' && c<='z')||(c>='A' && c<='Z')){
                char t=s.charAt(i);
                if(t>='A' && t<='Z')
                    t= (char) (t+cha);
                allchars.add( t);
            }
        }

        for(int i=0;i<allchars.size()/2;i++){
            if(allchars.get(i)!=allchars.get(allchars.size()-1-i))
                return false;
        }
        return true;
    }
}
